import { GenericAccountId, u32 } from "@polkadot/types";
import { TypeRegistry } from '@polkadot/types/create';
import { u8aConcat, u8aToHex, stringToU8a } from '@polkadot/util';

export function sleep(ms) {
    return new Promise((resolve, reject) => {
        setTimeout(function () {
            resolve();
        }, ms);
    });
}
export function getProxyAuthorizeMessage(ossAccountId, exp) {
    const registry = new TypeRegistry();
    const accountId = new GenericAccountId(registry, ossAccountId);
    // Block number as u32 (or could be u64, depending on your Rust type)
    const blockNumber = new u32(registry, exp);
    // Concatenate the two byte arrays
    let start = "<Bytes>";
    let end = "</Bytes>";
    return u8aConcat(stringToU8a(start), accountId.toU8a(), blockNumber.toU8a(), stringToU8a(end));
}